package xyz.zhouxf.rpc.loadbalance.impl;

import com.alibaba.nacos.api.naming.pojo.Instance;
import xyz.zhouxf.rpc.loadbalance.LoadBalancer;

import java.util.List;
import java.util.Random;

/**
 * @author zhouxf
 * @date 2022/9/27
 */
public class RandomLoadBalancer implements LoadBalancer {
    @Override
    public Instance selectInstance(List<Instance> instanceList) {
        return instanceList.get(new Random().nextInt(instanceList.size()));
    }
}
